<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>店铺进货列表</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#btnExport").click(function(){
                top.$.jBox.confirm("确认要导出进货订单数据吗？","系统提示",function(v,h,f){
                    if(v=="ok"){
                        $("#searchForm").attr("action","${ctx}/sys/orderProduct/exportTenement");
                        $("#searchForm").submit();
                    }
                },{buttonsFocus:1});
                top.$('.jbox-body .jbox-icon').css('top','55px');
            });
        });
        function page(n,s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").attr("action","${ctx}/sys/orderProduct/orderProductList");
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/sys/orderProduct/orderProductList">店铺进货列表</a></li>
</ul>
<form:form id="searchForm" modelAttribute="tbOrder" action="${ctx}/sys/orderProduct/orderProductList/" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <div style="margin-top:8px;">
        <label>店铺名称：</label><input type="text" name="userName" value="${tbOrder.userName}" htmlEscape="false" maxlength="50" class="input-medium"/>
        <label>订单类型：</label>
        <select name="productType" class="input-medium">
            <option value="-1">全部</option>
            <option  value="3" <c:if test="${tbOrder.productType==3}">selected</c:if> >生活预定</option>
            <option  value="4" <c:if test="${tbOrder.productType==4}">selected</c:if>>便利生活</option>
            <option  value="2" <c:if test="${tbOrder.productType==2}">selected</c:if>>海外代购</option>
        </select>
            <label>日期范围：&nbsp;</label>
            <input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20"
                   class="input-mini Wdate" value="<fmt:formatDate value="${tbOrder.beginDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
            --&nbsp;<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
                           value="<fmt:formatDate value="${tbOrder.endDate}" pattern="yyyy-MM-dd"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
        <input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
    </div>
</form:form>
<span><font style="color: #00A6C7">${message1}</font></span>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>店铺名称</th>
        <th>订单号</th>
        <th>订单类型</th>
        <th>订单状态</th>
        <th>订单时间</th>
        <th>订单总额</th>
        <th>联系人</th>
        <th>联系电话</th>
        <th>备注</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="tbOrder">
        <tr>
            <td>${tbOrder.userName}</td>
            <td>${tbOrder.orderNo}</td>
            <td>
                <c:if test="${tbOrder.productType==4}">
                    便利生活
                </c:if>
                <c:if test="${tbOrder.productType==3}">
                    生活预定
                </c:if>
                <c:if test="${tbOrder.productType==2}">
                    海外代购
                </c:if>

            </td>
            <td>
                <c:if test="${tbOrder.orderState eq '0'}">
                    未确认（未支付）
                </c:if>
                <c:if test="${tbOrder.orderState eq '1'}">
                    已确认(已支付)
                </c:if>
                <c:if test="${tbOrder.orderState eq '2'}">
                    待发货
                </c:if>
                <c:if test="${tbOrder.orderState eq '3'}">
                    已发货
                </c:if>
                <c:if test="${tbOrder.orderState eq '4'}">
                    已完成
                </c:if>
                <c:if test="${tbOrder.orderState eq '5'}">
                    已取消
                </c:if>
                <c:if test="${tbOrder.orderState eq '6'}">
                    已关闭
                </c:if>
            </td>
            <td><fmt:formatDate value="${tbOrder.orderTime}" type="both"/></td>
            <td>${tbOrder.orderAmount}</td>
            <td>${tbOrder.contactName}</td>
            <td>${tbOrder.contactMobile}</td>
            <td>${tbOrder.orderDescribe}</td>
            <td>
                <c:choose>
                    <c:when test="${tbOrder.orderState eq '1'}">
                         <a href="${ctx}/sys/orderProduct/queryOrder/${tbOrder.id}">发货</a>
                    </c:when>
                    <c:when test="${tbOrder.orderState eq '2'}">
                        <a href="${ctx}/sys/orderProduct/queryOrder/${tbOrder.id}">发货</a>
                    </c:when>
                    <c:when test="${tbOrder.orderState eq '0'}">
                        <a href="${ctx}/sys/orderProduct/editInputOrderPro/${tbOrder.id}">确认收款</a>
                    </c:when>
                    <c:otherwise>
                        <a href="${ctx}/sys/orderProduct/queryOrder/${tbOrder.id}">查看明细</a>
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${page}</div>
</body>
</html>